package com.yami.shop.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class EmailService {

    @Autowired
    private JavaMailSender mailSender;

    public void sendVerificationCode(String toEmail, String verificationCode) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setTo(toEmail);
        message.setFrom("laye_0730@qq.com");
        message.setSubject("邮箱验证码");
        message.setText("您的验证码是: " + verificationCode + "，有效期为 5 分钟。");
        mailSender.send(message);
    }
}